<?php
class PagesController extends Controller{

	function view($id){
		$this->loadModel('Brocante');
		
		$d['page'] = $this->Brocante->findFirst( array(
			'conditions' => array('online' => 1,'idBrocante'=>$id,'type'=>'page') 
				));
		
		if(empty($d['page'])){
			$this->e404('Page introuvable');
		}

		$this->set($d);
	}

	/**
	 * permet de recuperer les pages pour le menu
	 */
	function getMenu(){
		$this->loadModel('Brocante');
		return $this->Brocante->find(array(
		'conditions' => array('online' => 1,'type'=>'page')
		 ));
	}

}
?>